<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!--meta name="viewport" content="width=device-width; initial-scale=1.0" -->
	<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0" />

	<title>Tumblr Slideshow</title>

	<!-- Google Web Fonts http://www.google.com/webfonts -->
	<link href='http://fonts.googleapis.com/css?family=Homenaje' rel='stylesheet' type='text/css'>

	<style type="text/css">
		html {
			-webkit-text-size-adjust: none;
		}
		body {
			/*background: #004080;*/
			/*background: #48c;*/
			background: #006;
			color: #e0e0e0;
			margin: 0;
			padding: 0;
			overflow: hidden;
			line-height: 90%;
			font: 20pt 'Homenaje', Arial, sans-seri;
			/*font: bold 22pt Arial, sans-serif; */
		}
		.clear {
			clear: both;
			height: 0px;
			overflow: hidden;
		}

		div#base {
			position: fixed;
			width: 100%;
			height: 100%;
			/* Ultimate CSS Gradient Generator - ColorZilla.com : http://www.colorzilla.com/gradient-editor/ */
			background: url();
			background: -moz-radial-gradient(center, ellipse cover, rgba(0,0,0,0) 0%, rgba(0,0,0,0.65) 100%); /* FF3.6+ */
			background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,0.65))); /* Chrome,Safari4+ */
			background: -webkit-radial-gradient(center, ellipse cover, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* Chrome10+,Safari5.1+ */
			background: -o-radial-gradient(center, ellipse cover, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* Opera 12+ */
			background: -ms-radial-gradient(center, ellipse cover, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* IE10+ */
			background: radial-gradient(center, ellipse cover, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* W3C */
		}

		div#photo {
			position: fixed;
			width: 100%;
			height: 100%;
			border: 0px;
			margin: 0px;
		}

		img {
			border: 0px;
			margin: 0px;
			padding: 0px;
			width: auto;
			height: 100%;
		}

		img.scr_normal, img.scr_mobile, img.scr_wide, img.src_high {
			border: 0px;
			filter: alpha(style=2,opacity=100,finishopacity=60);
			box-shadow: 0px 0px 20px rgba(0,0,0,.8);
			-webkit-box-shadow: 0px 0px 20px rgba(0,0,0,.8);
			-moz-box-shadow: 0px 0px 20px rgba(0,0,0,.8);
			/*box-shadow: 0px 0px 20px rgba(0,0,0,.8);*/
			/*webkit-box-shadow: ;*/
			/*box-shadow: inset 0px 0px 20px #888;*/
			opacity: 0.7;
		}

		img.scr_normal {
			width: auto;
			height: 100%;
			margin-top: 0px;
			margin-left: 0px;
		}
		img.scr_mobile {
			height: auto;
			width: 100%;
			margin-top: 0px;
			margin-left: 0px;
		}
		img.scr_wide {
			width: 140%;
			height: auto;
			margin-top: 0px;
			margin-left: -20%;
		}
		img.scr_high {
			width: 68%;
			height: auto;
			margin-top: 0px;
			margin-left: 16%;
		}

		#centerbox {
			position: fixed;
			width: 50%;
			height: 100%;
			left: 25%;
			top: 46%;
			text-align: center;
			#text-align: center; /*IE */
			word-wrap: break-word;
			word-break: keep-all;
			white-space: pre-line;
		}

		#textbox {
			position: fixed;
			width: 100%;
			height: 100%;
			left: 0px;
			top: 0px;
			text-align: right;
			#text-align: right; /*IE */
			word-wrap: break-word;
			word-break: keep-all;
			white-space: pre-line;
		}
		.text {
			position: absolute;
			right: 0.1em;
			bottom: 0.1em;
			padding: 4px;
			/*text-shadow: 0px 0px 12px rgba(0,0,0,0.9);*/
			/*text-shadow: 0px 0px 0.3em rgba(0,0,0,0.9);*/
			/*text-shadow:#ddd 1px 1px 0px, #999 0px 0px 10px, #999 0px 0px 10px;*/
			/*text-shadow:#444 2px 2px 0px 0.5, #999 0px 0px 0.15em, #333 0px 0px 0.15em;*/
			text-shadow: #000 0px 0px 0.2em;/*dropshadow*/
			word-wrap: break-word;
			word-break: keep-all;
			white-space: pre-line;
			color: #dcc;
		}
		.glossy {
			position: absolute;
			padding: 4px;
			text-shadow: #222 0px 0px 0.15em, #88a 0px 0px 0.6em;/*glossy*/
			color: #dcc;
		}
		.shadow {
			position: absolute;
			margin-bottom: 0.15em;
			margin-right: 0.185em;
			right: 0.1em;
			bottom: 0.1em;
			padding: 4px;
			word-wrap: break-word;
			word-break: keep-all;
			white-space: pre-line;
			color: black;
			filter:progid:DXImageTransform.Microsoft.Blur(PixelRadius='6',MakeShadow='true',ShadowOpacity='0.8');
		}
		.half {
			opacity:0.65;
		}
	</style>

<!--[if gte IE 9]>
  <style type="text/css">
    div#base {
       filter: none;
    }
  </style>
<![endif]-->

	<!--script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script -->
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

	<script type="text/javascript">

	// --------------------------------------------------------------------

		var gUser = "private-photosonic"; // <-- tumblr user name

	// --------------------------------------------------------------------

	var gIntervalTimeInit = 12000;
	var gIntervalTimeIncrease = 200;
	var gIntervalTimeMax = 32000;

	var gTempTime = 0;
	var gIntervalTime = gIntervalTimeInit;

	var gTitle = "";
	var gTotal = 1;
	var gIndex = 0;
	var gCount = 0;
	var gWordsIndex = 0;
	var gIsWords = false;
	var gIsDispText = false;

	var loading_image_name = "loading.gif";

	var delayed_json = {
		"tumblelog" : {
			"title" : "loading..",
			"name" : "",
		},
		"posts-start": 0,
		"posts-total": 1,
		"posts-type": "photo",
		"posts": [{
				"url": loading_image_name,
				"type": "photo",
				"photo-link-url": loading_image_name,
				"width": "100",
				"height": "64",
				"photo-url-1280": loading_image_name,
				"photo-url-500": loading_image_name,
				"photos": [],
				"tags": ["$fi"]
		}]
	};

	var words = new Array(
	"Don't think. Feel!",
	"All the world's a stage.",
	"Just do it!",
	"Take it easy.",
	"Fun anyone?",
	"Live in your world.\nPlay in ours.",
	"Get ready for rush hour.",
	"Boys will be boys.",
	"History is written by the winners.",
	"Rules are made to be broken.",
	"Something wicked\nthis way comes.",
	"Expect the Impossible.",
	"The future is history.",
	"Find Your Voice.",
	"Love is friendship\nset on fire.",
	"Fight the Future.",
	"Never say never.",
	"Freedom! Forever!",
	"Join the Evolution.",
	"Forget what you\nthink you know.",
	"With great power comes\ngreat responsibility.",
	"The Adventure Continues...",
	"Everything Needs Love.",
	"Don't think you are,\nknow you are.",
	"The secret lies within.",
	"Flexibility is strength.",
	"Do you know who\nyour enemy is?",
	"Enough is a feast.",
	"Feel The Air.",
	"Ready or Not!",
	"Love is all you need.",
	"It's The Private Photosonic");

	// --------------------------------------------------------------------
	var __to_id = null;

	function timeoutReload(timer) {

		if (__to_id) {
			clearTimeout(__to_id);
			__to_id = null;
		}

		if (timer) {
			__to_id = setTimeout(function(){
									window.location.reload();
									cleartimeout(__to_id);
									__to_id = null;
								}, timer);
		}
	}

	// --------------------------------------------------------------------

	function interval(func, time)
	{
		func();
		var i_id = setTimeout(function () {
								clearTimeout(i_id);
								i_id = null;
								interval(func, time);
							}, time);
	}

	// --------------------------------------------------------------------

	var _rand_seed = new Date().getUTCMilliseconds() & 0x7fffffff;

	function _rand(max) {
		_rand_seed = (_rand_seed * 1103515245 + 12345) & 0x7fffffff;
		return (_rand_seed >> 7) % Math.floor(max);
	}

	// ------------------------------------------------------------------------

	function set_text(str)
	{
		if (gIsDispText)
		{
			$("#date").show().html(str);
			$("#date-shadow").show().html(str);
		}
		else
		{
			$("#date").hide();
			$("#date-shadow").hide();
		}
	}

	function set_date()
	{
		//var week = new Array('日', '月', '火', '水', '木', '金', '土');
		var week = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
		var now = new Date(); //現在の日付
		var y = now.getFullYear();
		var m = now.getMonth() + 1;
		var d = now.getDate();
		var w = now.getDay();//曜日
		var hh = now.getHours();
		var mm = now.getMinutes();
		if (mm < 10) { mm = "0" + mm; }
		//var str = gTitle+"\n"+y+"/"+m+"/"+d+" "+week[w]+" "+hh+":"+mm;
		var str = gTitle+"<br>"+y+"/"+m+"/"+d+" <small>"+week[w]+"</small> "+hh+":"+mm;
		//var str = gTitle+"\n"+y+"/"+m+"/"+d+" "+hh+":"+mm;
		set_text(str);
	}

	// --------------------------------------------------------------------

	function set_layout(n, rate)
	{
		var ofs_v = "0.2em";
		var ofs_h = "0.4em";

		var w = $("#textbox").width();
		var font_size = (w/21)+3;

		if (font_size < 12)
			font_size = 12;

		font_size = Math.floor(font_size*rate);
		$("#textbox").css("font-size", font_size+"pt");

		switch (n&0xff) // top or bottom ?
		{
			case 0:
			case 1://top
				$("#date").css("top", ofs_v)
						.css("bottom", "auto");
				$("#date-shadow").css("top", ofs_v)
								.css("bottom", "auto")
								.css("margin-top", "-6px")
								.css("margin-bottom", "auto");
				break;

			case 5://middle center
			
				$("#date").css("top", "36%") //"50%") //"38%")
						.css("bottom", "auto");
				$("#date-shadow").css("top", "36%")//"50%") //"38%")
								.css("bottom", "auto")
								.css("margin-top", "-5px")
								.css("margin-bottom", "auto");
			//	var _tmp1 = ($("span#date.text").height()/2);
			//	var _tmp2 = ($("span#date-shadow.shadow").height()/2);

			//	$("#date").css("margin-top", -_tmp1);
			//	$("#date-shadow").css("margin-top", -_tmp2);
			//	console.log(":"+_tmp1+":"+_tmp2);
			/*
				$("#textbox").css("vertical-align","middle");
				$("#date").css("top", "auto")
						.css("bottom", "auto")
						.css("vertical-align","middle");
				$("#date-shadow").css("top", "auto")
								.css("bottom", "auto")
								.css("vertical-align","middle")
								.css("margin-top", "-0.21em")
								.css("margin-bottom", "auto");
								*/
				break;

			case 2:
			case 3://bottom
				$("#date").css("top", "auto")
						.css("bottom", ofs_v);
				$("#date-shadow").css("top", "auto")
								.css("bottom", ofs_v)
								.css("margin-top", "auto")
								.css("margin-bottom", "6px");
				break;
		}

		switch (n&0xff) // right or left ?
		{
			case 0:
			case 3://left
				$("#textbox").css("text-align","left")
							.css("#text-align","left");
				$("#date").css("width", "100%")
							.css("left", ofs_h)
							.css("right", "auto");
				$("#date-shadow").css("width", "100%")
								.css("left", ofs_h)
								.css("right", "auto")
								.css("margin-left", "-6px")
								.css("margin-right", "auto");
				break;

			case 5:
				$("#textbox").css("text-align","center")
							.css("#text-align","center");
				$("#date").css("width", "auto")
							.css("left", "12%")
							.css("right", "12%");
				$("#date-shadow").css("width", "auto")
								.css("left", "12%")
								.css("right", "12%")
								.css("margin-left", "auto")
								.css("margin-right", "14px");
				break;

			case 1:
			case 2://right
				$("#textbox").css("text-align","right")
							.css("#text-align","right");
				$("#date").css("width", "100%")
							.css("left", "auto")
							.css("right", ofs_h);
				$("#date-shadow").css("width", "100%")
								.css("left", "auto")
								.css("right", ofs_h)
								.css("margin-left", "auto")
								.css("margin-right", "6px");
				break;
		}
	}

	// --------------------------------------------------------------------

	function tumblr_image(json, type)
	{
		if (!json)
			return;

		gTotal = json["posts-total"];
		var post = json["posts"][0];
		var win_w = $(window).width();
		var win_h = $(window).height();
		var is_gloss = false;
		var is_half = false;

		var buffer = $("#buffer>img").clone();
		var selTextbox = $("#textbox");

		$("#textbox").fadeOut("normal", function() {

			$("#photo").fadeOut("normal", function() {

				$("#photo").html(buffer); /* ←ここで画像が切り替わる */

				var selImg = $("#photo").find("img:first");
				var w = selImg.width() > 1 ? selImg.width() : win_w;
				var h = selImg.height() > 1 ? selImg.height() : win_h;
				var pos_x = Math.floor(win_w - w);
				var pos_y = Math.floor(win_h - h);
				var layout = selImg.attr("layout") & 0xff; //num cast
				var is_right = (layout == 1 || layout == 2);
				var frame = selImg.attr("frame");
				var gold_w = (win_w - w) * 0.82;
				var rate = 1.0;

				selImg.stop().animate({opacity: 0.7}, "fast");
				selTextbox.stop().animate({opacity: 1.0}, "fast");
				if (gCount > 1)
				{
					selImg.mouseover(function(){
						//this.style.opacity = 1.0;
						$(this).stop().animate({opacity: 1.0}, "slow");
						selTextbox.stop().animate({opacity: 0.0}, "slow");
					}).mouseout(function(){
						//this.style.opacity = 0.7;
						$(this).stop().animate({opacity: 0.7}, "slow");
						selTextbox.stop().animate({opacity: 1.0}, "slow");
					});
				}

				if ((gCount % 10) == 9) {
					gTitle = words[gWordsIndex++];
					gWordsIndex %= (words.length-1);
					gIsWords = true;
				}
				else
				{
					gTitle = json["tumblelog"]["title"];
					gIsWords = false;
				}

				if (gIsWords || gCount == 1) //2)
				{
					layout = 5;
					rate = 1.3;
					gIsDispText = true;
				}

				set_date();

				/*if (gCount == 1)
				{
					selImg.css("width", "30%")
							.css("height", "auto");
					selImg.css("margin-left", Math.floor(win_w/2 - selImg.width()/2))
							.css("margin-top", Math.floor(win_h/2 - selImg.height()/2))
				}
				else*/
				if (win_w > win_h || frame == "inner") // 横画面モード
				{
					if (((frame == "inner") && (win_w < w)) || //inner指定されていて横幅が画面より大きい場合もしくは、
						((win_w > w) && (win_w*0.85) < w)) //少しだけ拡大すれば横画面ぴっちり収まる場合
					{
						selImg.removeClass()
								.addClass("scr_mobile");
						w = selImg.width(); // 画像サイズ変わったので参照し直さないとだめ
						h = selImg.height();
					}

					pos_y = Math.floor(win_h/2 - h/2);

					if (frame == "inner")
					{
						$("#textbox").css("width", win_w)
									.css("height", win_h)
									.css("left", 0)
									.css("right", "auto")
									.css("top", 0);
						set_layout(layout, 1.25);
					}
					else
					if ((w < win_w*0.5) && (layout != 5)) // 横画面：文字を外に出す
					{
						if (is_right)
						{
							//スペース：画像：テキスト
							pos_x = Math.floor(win_w - w - gold_w);
							$("#textbox").css("width", Math.floor(gold_w*0.85))
										.css("height", Math.floor(Math.min(h,win_h)))
										.css("left", Math.floor(win_w-(gold_w*1.01))) //気持ち左に調整
										.css("right", "auto")
										.css("top", Math.floor(Math.max(0,pos_y)));
							set_layout(3, 1.6);
							is_gloss = true;
						}
						else
						{
							//テキスト：画像：スペース
							pos_x = Math.floor(gold_w);
							$("#textbox").css("width", Math.floor(gold_w*1.0))
										.css("height", Math.floor(Math.min(h,win_h)))
										.css("left", 0)
										.css("right", "auto")
										.css("top", Math.floor(Math.max(0,pos_y)));
							//set_layout(2, 1.7);
							set_layout(5, 1.4);
							is_gloss = true;
						}
					}
					else // 横画面：文字を絵に重ねる
					{
						pos_x = Math.floor(win_w/2 - w/2);
						$("#textbox").css("width", Math.floor(Math.min(w,win_w)))
									.css("height", Math.floor(Math.min(h,win_h)))
									.css("left", Math.floor(Math.max(0,pos_x)))
									.css("right", "auto")
									.css("top", Math.floor(Math.max(0,pos_y)));

						if (layout == 5 && rate == 1.0)
							rate = 1.3;
						set_layout(layout, rate);
					}

					selImg.css("margin-left", pos_x)
							.css("margin-top", pos_y);
				}
				else // 縦画面モード
				{
					if (win_w <= 480) //縦画面：ミニサイズ
					{
		//layout = 5;
		rate = 1.3;
						if (h > win_h) // 縦画面：ミニサイズで画像高さがウィンドウ高さより大きい
						{
							pos_y = Math.floor((win_h-h) * 0.35);
							pos_x = Math.floor(win_w/2 - w/2);
							selImg.css("margin-left", pos_x)
									.css("margin-top", pos_y);
						}
						else // 縦画面：ミニサイズで画像高さがウィンドウより小さい（拡大表示）
						{
							selImg.removeClass()
									.addClass("scr_normal");
							w = selImg.width(); // 画像サイズ変わったので参照し直さないとだめ
							h = selImg.height();

							if (w < 1) w = win_w;
							if (h < 1) h = win_h;

							pos_x = Math.floor(win_w/2 - w/2);
							pos_y = 0;

							if (frame == "right")
							{
								pos_x = win_w-w;
							}
							else if (frame == "left")
							{
								pos_x = 0;
							}
							else if (frame == "center")
							{
								;
							}
							else if (layout == 0 || layout == 1 || layout == 3)
							{
								var xofs = Math.floor((win_w - w) * 0.35);
								pos_x += (is_right) ? -xofs : xofs;
							}

							selImg.css("margin-left", pos_x)
									.css("margin-top", pos_y);
						}
					}
					else //縦画面モード：ノーマルサイズ
					{
						if (
							((win_h * 1.2) < h) || 
							(((win_h * 0.82) < h) && (h < win_h))
						)
						{
							selImg.removeClass()
									.addClass("scr_normal");
							w = selImg.width(); // 画像サイズ変わったので参照し直さないとだめ
							h = selImg.height();
						}

						pos_x = Math.floor(win_w/2 - w/2);
						pos_y = Math.floor(win_h - h);
						if ((h + 64) < win_h)
							pos_y -= 32;
						else if (h > win_h)
							pos_y += ((h - win_h) * 0.82);

						selImg.css("margin-left", pos_x)
								.css("margin-top", pos_y);
					}

//					if (layout == 5)
						rate = 1.25;

					if (((win_h * 0.55) > h) && layout != 5)
					{
						layout = 5;
						rate = 1.45;
						is_gloss = true;
						$("#textbox").css("width", win_w)
									.css("height", Math.floor(win_h - h))
									.css("left", 0)
									.css("top", 0);
					}
					else
					{
						var tb_w = (layout == 5) ? win_w : Math.floor(win_w*0.84);
						$("#textbox").css("width", tb_w)
									.css("height", Math.min(h,win_h))
									.css("left", is_right ? Math.floor(win_w-tb_w) : 0)
									.css("top", Math.max(0,pos_y));
					}

					set_layout(layout, rate);
				}

				if (is_gloss)
					$("#date").addClass("glossy");
				else
					$("#date").removeClass("glossy");
				//if (layout == 5 && gIsWords)//is_half)
				//	$("#date").addClass("half");
				//else
				//	$("#date").removeClass("half");
			})
			.fadeIn("slow", function() {
				$("#textbox").fadeIn("normal");
			});

		});

		var _layout = 2; //0:left-top 1:right-top 2:right-bottom 3:left-bottom
		var _frame = "normal";
		var _class = "scr_normal";
		var _name = post["photo-url-1280"];

		//if (win_w <= 500)
		//	_name = post["photo-url-500"];

		if (post["tags"])
		{
			for (var i = 0; i < post["tags"].length; i++)
			{
				var p = post["tags"][i].toLowerCase();
				if (p == "$lt") _layout = 0;
				else if (p == "$rt") _layout = 1;
				else if (p == "$rb") _frame = "left";
				else if (p == "$lb") _layout = 3;
				else if (p == "$mc") _layout = 5;
				else if (p == "$nottl") _layout = 6;
				else if (p == "$fi") _frame = "inner";
				else if (p == "$wd") _frame = "wide";
				else if (p == "$hs") _frame = "high";
				else if (p == "$cw") _frame = "center";
				else if (p == "$lw") _frame = "left";
				else if (p == "$rw") _frame = "right";
			}
		}
//_layout = 5;
		if (_frame == "high")
			_class = "scr_normal";
		else if (_frame == "wide")
			_class = "scr_wide";
		else if (win_w < win_h)
			_class = "scr_mobile";

		$("#buffer") /* ここで次にロードする画像が生成される */
			.children("img")
			.removeClass()
			.addClass(_class)
			.attr("layout", _layout)
			.attr("frame", _frame)
			.attr("src", _name);

		if (_name.toLowerCase().indexOf(".gif") >= 0)
			gTempTime = Math.min(gIntervalTime, 10000);

		if (gCount == 7)
			gIndex += Math.floor(Math.random() * gTotal);
		else if ((gCount % 10) == 9)
			gIndex += Math.floor(Math.random() * (gTotal/10));

		gIndex += (Math.floor(Math.random() * 11) + 1);
		gIndex %= gTotal;
		gCount++;
	}

	// --------------------------------------------------------------------

	function tumblr_photo_jsonp(user, n, func, errfunc)
	{
		$.ajax({
			url: "http://"+user+".tumblr.com/api/read/json",
			data: {
				type: "photo",
				num: n,
				start: gIndex,
			},
			json: "callback",
			dataType: "jsonp",
			callback: "callback",
			success: func,
			error: errfunc,
			complete: function() {},
		});
	}


	// ========================================================================

	function photosonic(user)
	{
		var tumblr_err_func = function(xml, msg, sss) {
			console.log(msg+":"+sss);
			gTempTime = 1000*60;
			func(delayed_json, "photo");
		}

		tumblr_photo_jsonp(user, 1, tumblr_image, tumblr_err_func);

		if ((gIntervalTime += gIntervalTimeIncrease) > gIntervalTimeMax)
			gIntervalTime = gIntervalTimeMax;

		var time = gTempTime != 0 ? gTempTime : gIntervalTime;
		gTempTime = 0;

		var interval_id = setTimeout(function () {
								clearTimeout(interval_id);
								time = null;
								interval_id = null;
								photosonic(user);
							},
							time);
	}

	function qr(num)
	{
		return num - Math.floor(Math.sqrt(Math.random()*(num*num)));
	}

	// --------------------------------------------------------------------

	gIntervalTime = gIntervalTimeInit;
	gWordsIndex = _rand(words.length);

	$(function() {
		//if((navigator.userAgent.match(/iPhone/i)) || 
		//	(navigator.userAgent.match(/iPod/i)) || 
		//	(navigator.userAgent.match(/iPad/i)) ||
		//	(navigator.userAgent.match(/Android/i))) {
			//setTimeout("scrollTo(0,1)", 100);
			setTimeout(function() {window.scrollTo(0,1);}, 100);
		//	}
		//}

		tumblr_photo_jsonp(gUser, 5, function(json, type) {
			set_text("");
			set_layout(2, 2.0);
			interval(set_date, 1000);
			//gTempTime = 5000;
			gTitle = json["tumblelog"]["title"];
			gTotal = json["posts-total"];
			var start_num = Math.min(gTotal, _rand(5));
			gIndex = (Math.random() < 0.333) ? _rand(gTotal) : (start_num+1+_rand(3));
			gIndex %= gTotal;
			document.title = document.title + " - "+gTitle;
			timeoutReload(1000*60*120);
			//photosonic(gUser);
			var t = new Date().getTime();
			var first_load_image = json["posts"][start_num]["photo-url-500"]+"?"+t;
			var img = new Image();
			img.src = first_load_image;
			img.onload = function() { photosonic(gUser); img = null;};
			$("#buffer").children("img")
				.removeClass()
				.addClass("scr_normal")
				.attr("src", first_load_image);
		},
		function(xml, msg, sss) {
			timeoutRelead(1000*15);
		});
	});

	// --------------------------------------------------------------------

	</script>
</head>
<body>

	<div id="base" style="z-index:0"></div>

	<div id="photo2" style="z-index:1"></div>
	<div id="photo" style="z-index:2"><img src="trans.png" class="loading"></div>

	<div id="messagebox" style="display:none;">
		<!--[if IE]><span id="mess-shadow" class="shadow" style="z-index:3"></span><![endif]-->
		<span id="mess" class="text" style="z-index:4"></span>
	</div>


	<div id="textbox" style="display:none;">
		<!--[if IE]><span id="date-shadow" class="shadow" style="z-index:5"></span><![endif]-->
		<span id="date" class="text" style="z-index:6"></span>
	</div>

	<!-- ------------------------------------------------ -->
	<div id="buffer" style="display:none;">
		<img src="loading.gif" class="scr_mobile">
	</div>

</body>
</html>